import {Cascader, Form} from 'antd'
import {omit} from 'ramda'
import {Group} from '../components'

const FormItem = Form.Item;

const FormCascader = ({required, loadData, textAlign, justify, span, placeholder, getFieldDecorator, initialValue, name, labelCol, label, options}) => {
    return (
        <Group spans={[span || 16]} justify={justify || 'center'} textAligns={[textAlign || 'left']}>
            <FormItem
                labelCol={{span: labelCol || 0}}
                wrapperCol={{span: 24 - (labelCol || 0)}}
                label={label}
            >
                {getFieldDecorator(name, {
                    initialValue: initialValue,
                    rules: [{required, message: '必填项'}]
                })(
                    <Cascader loadData={loadData}
                              options={options||[]}
                              placeholder={placeholder}
                    />
                )}
            </FormItem>
        </Group>
    )
}

export default FormCascader